package com.yj.ccs.abs.web.assetData.mapper;

import com.yj.ccs.abs.web.assetData.entity.Periods;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Copyright 2018 (C) Yunjian-VC
 * Created on : 2018/4/9
 * Author     : Unbelievable9
 **/
@Repository
@Mapper
public interface PeriodsMapper {

    @Insert("INSERT INTO periods (period, start_date, end_date, create_time) " +
            "VALUES(#{item.period}, #{item.start_date}, #{item.end_date}, NOW())")
    void create(@Param("item") Periods item);

    @Select("select * from periods order by period desc")
    List<Periods> getAssetPeriods();

    @Select("select * from periods order by period desc limit 1")
    Periods getLastestPeriods();
}
